package models;

import java.io.Serializable;

import javax.persistence.Embeddable;

@Embeddable
public class Location implements Serializable {
	//40.677885,-73.897424 Madison Square Garden
	//Hotel Brooklin 40.680622,-73.948588
	
	public static final double ZERO = 0.000000;
	public static final double EARTH_RADIUS = 6371.01;
	//IN KILOMETERS
	public static final double MAX_DISTANCE = 5;
	
	private Double latitude;
	private Double longitude;
	
	public Double getLatitude() {
		return latitude;
	}
	
	public void setLatitude(Double latitude) {
		this.latitude = latitude;
	}
	
	public Double getLongitude() {
		return longitude;
	}

	public void setLongitude(Double longitude) {
		this.longitude = longitude;
	}
	
	public static void main(String[] args) {
		double madisonLat = Math.toRadians(40.677885); 
		double hotelLat = Math.toRadians(40.680622); 
		double madisonLong = Math.toRadians(-73.897424); 
		double hotelLong = Math.toRadians(-73.948588); 
	
		double result = Math.acos(Math.sin(madisonLat) * Math.sin(hotelLat) + Math.cos(madisonLat) * Math.cos(hotelLat) * Math.cos(madisonLong - hotelLong)) * Location.EARTH_RADIUS;
		System.out.println(result);
	}
	
}
